package com.liuyi.netty.im.lychat.config;

import com.alicp.jetcache.anno.config.EnableCreateCacheAnnotation;
import com.alicp.jetcache.anno.config.EnableMethodCache;
import com.alicp.jetcache.autoconfigure.JedisPoolFactory;
import com.alicp.jetcache.autoconfigure.RedisAutoConfiguration;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.DependsOn;
import redis.clients.jedis.JedisPool;

/**
 * @author Mr.Fmy
 * @since 2021/12/25
 */
@Configuration
//开启权限注解
@EnableCreateCacheAnnotation
@EnableMethodCache(basePackages = "com.liuyi.netty.im.lychat")
public class JetCacheConfig {


    @Bean(name = "defaultPool")
    @DependsOn(RedisAutoConfiguration.AUTO_INIT_BEAN_NAME)
    public JedisPoolFactory defaultPool() {
        return new JedisPoolFactory("remote.default", JedisPool.class);
    }
}
